package com.szgr.baoyin.myview;

import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

import com.szgr.baoyin.R;

/**
 * Created by yang on 15/9/30.
 */
public class IconView extends View {
    public int index;
    private static final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    public int circleRadius;
    public int color = Color.WHITE;
    public IconView(Context context, int index,int circleRadius){
        this(context);
        this.index = index;
        this.circleRadius = circleRadius;
//        mPaint.setStrokeWidth(2);
    }
    public IconView(Context context) {
        super(context);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if(isSelected()){
//            mPaint.setStyle(Paint.Style.FILL);
            canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.shouyedian),0,0,mPaint);
        }else{
//            mPaint.setStyle(Paint.Style.STROKE);
            canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.shouyedian2),0,0,mPaint);
        }
//        mPaint.setColor(color);
        //绘制空心圆
//        canvas.drawCircle(getWidth() / 2, getHeight() / 2, circleRadius, mPaint);
    }
}
